package com.hanggold.springboot;


import com.hanggold.springboot.listener.MyApplicationEvent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.stream.Stream;

//@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class Lesson5Application {


    public static void main(String[] args) {

        Stream.of(args).forEach(e -> {
            System.out.println("e: " + e);
        });


        ConfigurableApplicationContext configurableApplicationContext =  SpringApplication.run(Lesson5Application.class,args);

//        new SpringApplicationBuilder(Lesson5Application.class).main()
//        StackTraceElement[] stackTraceElements = new RuntimeException().getStackTrace();

        MyApplicationEvent myApplicationEvent = new MyApplicationEvent("hello  my event");

        configurableApplicationContext.publishEvent(myApplicationEvent);




//        for (StackTraceElement  stackTraceElement : stackTraceElements){
//
//            System.out.println(stackTraceElement.getClassName()+" ,"+ stackTraceElement.getMethodName());
//        }


    }


}
